<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:vti="http://java.sun.com/jsf/composite/components/vti">

    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>
            <ui:insert name="titulo">
                <h:outputText value="#{msgs['titulo.aplicacao']}" />
            </ui:insert>
        </title>
        <link href="#{request.contextPath}/resources/css/wf-blue-theme.css" rel="stylesheet" type="text/css"/>
        <link href="#{request.contextPath}/resources/css/estilos.css" rel="stylesheet" type="text/css"/>
        <link href="#{request.contextPath}/resources/css/login.css" rel="stylesheet" type="text/css"/>
        <link rel="icon" href="#{request.contextPath}/resources/images/favicon-vti.ico" type="image/x-icon"/>
        <script type="text/javascript" src="#{request.contextPath}/resources/javascript/util.js"></script>
        <script type="text/javascript">
            history.forward(1);  //barrar o botão voltar
            
            $ = jQuery.noConflict();
            
            function redimensionar() {
                var tam = $(window).height();
                var height = tam-22;
                var conteudo = $("#conteudo");
                conteudo.css("height", height);
                
                var notify = $("#notify");
                var top = parseInt(height/5);
                notify.css("padding-top", top);
            }
            
            function configurarEnter(form, botao) {
                $(form).keyup(function(e) { 
                    if (e.keyCode === 13) { 
                        $(botao).click();
                    } 
                });
            }
            
            $(function() {
                redimensionar();
                configurarEnter("#formLogin",".btnLogin");
                configurarEnter("#formEsqueci",".btnLogin");
                configurarEnter("#formPassword",".btnLogin");
            });
            
            $(window).resize(function() { 
                redimensionar();
            });
        </script>
    </h:head>
    <h:body>
        <f:metadata>
            <f:event type="preRenderView" listener="#{erroBean.processarErroLogin}" />
        </f:metadata>
        <div id="tudo" >
            <div id="corpo">
                <div id="conteudo">
                    <div id="barraEsquerda">
                        <div id="notify">
                            <h:panelGroup id="messages" layout="block">
                                <h:panelGroup layout="block" class="login-status error-notice"
                                            rendered="#{messageFactory.isMessageErro()}">
                                    <span class="error-icon"></span>
                                    <div id="login-status-message">
                                        <h:messages globalOnly="true" showDetail="true" showSummary="false" />
                                    </div>
                                </h:panelGroup>
                                <h:panelGroup layout="block" class="login-status info-notice"
                                            rendered="#{!messageFactory.isMessageErro() and !empty facesContext.getMessageList()}">
                                    <span class="info-icon"></span>
                                    <div id="login-status-message">
                                        <h:messages globalOnly="true" showDetail="true" showSummary="false" />
                                    </div>
                                </h:panelGroup>
                            </h:panelGroup>
                        </div>
                        <div id="login-container">
                            <div id="login-sub-container">
                                <div id="login-sub-header">
                                    <p>Leilão Virtual</p>
                                </div>
                                <div id="login-sub">
                                    <ui:insert name="conteudo" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div style="clear: both;"></div>
                </div>
            </div>
            <div id="rodape">
                <div id="rodapeEsquerdo">
                    <p><h:outputLabel value="#{msgs['rodape.versao']}" /></p>
                </div>
                <div id="rodapeDireito">
                    <p><h:outputLabel value="#{msgs['rodape.texto']}" /></p>
                </div>
                <div style="clear: both;"></div>
            </div>
        </div>
        <vti:modalProgress id="modalProgress" />
    </h:body>
</html>